#include "front/text_normalize.h"

using namespace std;
using namespace ppspeech;

//	Α, Β, Γ, Δ, Ε, Ζ, Η, Θ, Ι, Κ, ∧, Μ, Ν, Ξ, Ο, ∏, Ρ, ∑, Τ, Υ, Φ, Χ, Ψ, Ω,
//	α, β, γ, δ, ε, ζ, η, θ, ι, κ, λ, μ, ν, ξ, ο, π, ρ, σ, τ, υ, φ, χ, ψ, ω, ς,
//	Αα、Ββ、Γγ、Δδ、Εε、Ζζ、Ηη、Θθ、Ιι、Κκ、∧λ、Μμ、Νν、Ξξ、Οο、∏π、Ρρ、∑σ、Ττ、Υυ、Φφ、Χχ、Ψψ、Ωω。

//	"Α", "Β", "Γ", "Δ", "Ε", "Ζ", "Η", "Θ", "Ι", "Κ", "∧", "Μ", "Ν", "Ξ", "Ο", "∏", "Ρ", "∑", "Τ", "Υ", "Φ", "Χ", "Ψ", "Ω",
//	"α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω", "ς",

/*	Α[913], Β[914], Γ[915], Δ[916], 
	Ε[917], Ζ[918], Η[919], Θ[920],
	Ι[921], Κ[922], ∧[8743], Μ[924],
	Ν[925], Ξ[926], Ο[927], ∏[8719],
	Ρ[929], ∑[8721], Τ[932], Υ[933],
	Φ[934], Χ[935], Ψ[936], Ω[937],

	α[945], β[946], γ[947], δ[948],
	ε[949], ζ[950], η[951], θ[952],
	ι[953], κ[954], λ[955], μ[956],
	ν[957], ξ[958], ο[959], π[960],
	ρ[961], σ[963], τ[964], υ[965],
	φ[966], χ[967], ψ[968], ω[969], ς[962],
*/

const map<wchar_t, wstring> MapWstrWstr_Greek = {
/*	Α, Β, Γ, Δ, 
	Ε, Ζ, Η, Θ,
	Ι, Κ, ∧, Μ,
	Ν, Ξ, Ο, ∏,
	Ρ, ∑, Τ, Υ,
	Φ, Χ, Ψ, Ω,
*/
	{L'Α', L"alpha"},		{L'Β', L"beta"},		{L'Γ', L"gamma"},		{L'Δ', L"delta"},
	{L'Ε', L"epsilon"},		{L'Ζ', L"zeta"},		{L'Η', L"eta"},			{L'Θ', L"theta"},
	{L'Ι', L"iota"},		{L'Κ', L"kappa"},		{L'∧', L"lambda"},		{L'Μ', L"mu"},
	{L'Ν', L"nu"},			{L'Ξ', L"xi"},			{L'Ο', L"omicron"},		{L'∏', L"pi"},
	{L'Ρ', L"rho"},			{L'∑', L"sigma"},		{L'Τ', L"tau"},			{L'Υ', L"upsilon"},
	{L'Φ', L"fine"},		{L'Χ', L"chi"},			{L'Ψ', L"psi"},			{L'Ω', L"omega"},

/*	α, β, γ, δ,
	ε, ζ, η, θ,
	ι, κ, λ, μ,
	ν, ξ, ο, π,
	ρ, σ, τ, υ,
	φ, χ, ψ, ω, ς,
*/
	{L'α', L"alpha"},		{L'β', L"beta"},		{L'γ', L"gamma"},		{L'δ', L"delta"},
	{L'ε', L"epsilon"},		{L'ζ', L"zeta"},		{L'η', L"eta"},			{L'θ', L"theta"},
	{L'ι', L"iota"},		{L'κ', L"kappa"},		{L'λ', L"lambda"},		{L'μ', L"mu"},
	{L'ν', L"nu"},			{L'ξ', L"xi"},			{L'ο', L"omicron"},		{L'π', L"pi"},
	{L'ρ', L"rho"},			{L'σ', L"sigma"},		{L'τ', L"tau"},			{L'υ', L"upsilon"},
	{L'φ', L"fine"},		{L'χ', L"chi"},			{L'ψ', L"psi"},			{L'ω', L"omega"},		{L'ς', L"sigma"},
};

void TextNormalizer::TnReGreekAlphabet(wstring* fpInWsentence)
{
	wstring tWstrResult;

	for(const wchar_t tcWchar : *fpInWsentence) {
		const auto tcIterator = MapWstrWstr_Greek.find(tcWchar);
		if(MapWstrWstr_Greek.end() != tcIterator) {	//找到希腊字母
			tWstrResult += L" " + tcIterator->second + L" ";
		}
		else {
			tWstrResult += tcWchar;
		}
	}
	*fpInWsentence = tWstrResult;
}
